package com.qf.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.dao.UserDao;
import com.qf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 千锋健哥
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public List<User> findAll() {
        List<User> list = userDao.findAll();
        return list;
    }

    @Override
    public PageInfo<User> findPage(Integer currentPage, Integer size) {
        //设置当前页和每页显示条数
        PageHelper.startPage(currentPage, size);
        //查询
        List<User> list = userDao.findAll();
        //封装分页对象
        PageInfo<User> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

}
